package com.lanju.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.lanju.model.ResultModel;
import com.lanju.service.AdminPermissionServiceIf;
import com.lanju.service.PermissionServiceIf;

@Controller
@RequestMapping("/organizationPerssion")
public class OrganizationPerssionController {
    
    @Autowired
    AdminPermissionServiceIf adminPermissionService;
    
    @Autowired
    PermissionServiceIf permissionService;
    
    @RequestMapping("/setAdminPerssion")
    @ResponseBody
    public ResultModel setAdminPerssion(
            @RequestParam(value="adminCode") String adminCode,
            @RequestParam(value="permissionIds") List<Integer> permissionIds){
                return adminPermissionService.setAdminPerssion(adminCode,permissionIds);
    }
    
    @RequestMapping("/getAdminPerssion")
    @ResponseBody
    public ResultModel getAdminPerssion(@RequestParam(value="adminCode") String adminCode){
                return permissionService.getAdminPerssion(adminCode);
    }
    
    @RequestMapping("/addAdminPerssion")
    @ResponseBody
    public ResultModel addAdminPerssion(
            @RequestParam(value="adminCode") String adminCode,
            @RequestParam(value="permissionid") String permissionid){
                return permissionService.addAdminPerssion(adminCode,permissionid);
    }
    
    @RequestMapping("/delAdminPerssion")
    @ResponseBody
    public ResultModel delAdminPerssion(
            @RequestParam(value="adminCode") String adminCode,
            @RequestParam(value="permissionid") String permissionid){
                return permissionService.delAdminPerssion(adminCode,permissionid);
    }
}
